﻿using PluginAPI.Core.Attributes;
using PluginAPI.Enums;
using PluginAPI.Events;
using RoleCustom.Main;
using Utils;


namespace RoleCustom.Event
{
    /// <summary>
    /// NTF Private Event
    /// </summary>
    public class NTFSpawnEvent
    {
        [PluginEvent(ServerEventType.PlayerSpawn)]
        public void OnNTFPrivateSpawn(PlayerSpawnEvent ev)
        {
            if (ev.Player.Role != PlayerRoles.RoleTypeId.NtfPrivate) return;

            TimeCoroutine.Delay(0.3f, () =>
            {
                ev.Player.RemoveItems(ItemType.KeycardMTFCaptain);
                ev.Player.RemoveItems(ItemType.KeycardMTFOperative);
                ev.Player.RemoveItems(ItemType.KeycardMTFPrivate);

                ev.Player.AddItem(ItemType.KeycardMTFPrivate);
                ev.Player.AddItem(ItemType.GrenadeFlash);

                //PlayerUtils.SetHP(ev.Player,
                //    CodeLoad.Singleton.Config.NTFPrivateEvent.Health,
                //    CodeLoad.Singleton.Config.NTFPrivateEvent.Health);
            });
        }


        [PluginEvent(ServerEventType.PlayerSpawn)]
        public void OnNTFCaptainSpawn(PlayerSpawnEvent ev)
        {
            if (ev.Player.Role != PlayerRoles.RoleTypeId.NtfCaptain) return;

            TimeCoroutine.Delay(0.3f, () =>
            {
                //PlayerUtils.SetHP(ev.Player,
                //    CodeLoad.Singleton.Config.NTFCaptainEvent.Health,
                //    CodeLoad.Singleton.Config.NTFCaptainEvent.Health);
            });
        }

        [PluginEvent(ServerEventType.PlayerSpawn)]
        public void OnNTFScientistSpawn(PlayerSpawnEvent ev)
        {
            TimeCoroutine.Delay(0.5f, () =>
            {
                if (ev.Player.Role != PlayerRoles.RoleTypeId.NtfSpecialist) return;

                //PlayerUtils.SetHP(ev.Player,
                //    CodeLoad.Singleton.Config.NTFScientistEvent.Health,
                //    CodeLoad.Singleton.Config.NTFScientistEvent.Health);
            });
        }

        [PluginEvent(ServerEventType.PlayerSpawn)]
        public void OnNTFLeaderSpawn(PlayerSpawnEvent ev)
        {
            TimeCoroutine.Delay(0.5f, () =>
            {
                if (ev.Player.Role != PlayerRoles.RoleTypeId.NtfSergeant) return;

                //PlayerUtils.SetHP(ev.Player,
                //    CodeLoad.Singleton.Config.NTFLeaderEvent.Health,
                //    CodeLoad.Singleton.Config.NTFLeaderEvent.Health);
            });
        }

    }
}
